﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;
using AppServicesHelloWorldApp.Services;
using AppServicesHelloWorldApp.Services.Core;
using Polenter.Services;

namespace AppServicesHelloWorldApp
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            createServices();

            Application.Run(new Form1());
        }

        private static void createServices()
        {
            // Timer
            AppServices.Instance.AddService<ITimer>(new DefaultTimer());

            // TimeProvider
            AppServices.Instance.AddService<ITimeProvider>(new DefaultTimeProvider());

            // Inject TimeProvider to Timer
            // AppServices automatically detects service dependency
            AppServices.Instance.InjectServices();
        }
    }
}
